package cn.gwm.flink.streaming.dws.reservecharge.enums;

import lombok.Getter;

/**
 * @author Liu.Nanfang
 * @date 2023/2/15 15:18
 * @description 充电电量类型
 */
@Getter
public enum ChargePowerTypeEnum {

    SLOW("1", "居民用电（低于1000V）"),
    SLOW_MERGER("2", "居民合表用电"),
    QUICK_SUPER("3", "大工业及工商业用电"),
    CHARGE_TYPE_OTHER("9", "其他"),
    ;
    /**
     * 值
     */
    private String code;
    /**
     * 描述
     */
    private String desc;

    ChargePowerTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据类型的名称，返回类型的枚举实例。
     *
     * @param code
     */
    public static ChargePowerTypeEnum fromCode(String code) {
        for (ChargePowerTypeEnum type : ChargePowerTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
